{% extends "personnel/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link href="../../static/personnel/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }

        .add_background {
            background: #A9A9A9;
        }

        .file {
            position: relative;
            display: inline-block;
            background: #D0EEFF;
            border: 1px solid #99D3F5;
            border-radius: 4px;
            padding: 4px 12px;
            overflow: hidden;
            color: #1E88C7;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }

        .file input {
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }

        .file:hover {
            background: #AADFFD;
            border-color: #78C3F3;
            color: #004974;
            text-decoration: none;
        }

        tr:hover {
            background-color: #DCDCDC;
        }

        .button_for_control {
            width: 130px;
            height: 30px;
            border: 1px solid #99D3F5;
            background: #D0EEFF;
            border-radius: 4px;
            letter-spacing: 0;
            line-height: 30px;
            color: #089bab;
            margin-top: 10px;
        }
        .attendance_tag {
            width: 150px;height: 40px;line-height: 40px;text-align: center;display: inline-block;vertical-align: top;cursor: pointer;
        }
        .attendance_active {
            border-bottom: #1E90FF 1px solid;color: #1E90FF;
        }

        .oline {
            border-top: 40px #fff solid;
            /*上边框宽度等于表格第一行行高*/
            width: 100%;
            /*让容器宽度为0*/
            height: 40px;
            /*让容器高度为0*/
            border-left: 80px #fff solid;
            /*左边框宽度等于表格第一行第一格宽度*/
            position: relative;
            /*让里面的两个子容器绝对定位*/

        }
        .oline::before {
            position: absolute;
            top: -40px;
            left: -80px;
            width: 150%;
            height: 40px;
            background: url() no-repeat 100% center;
            content: '';
        }

        .span1 {
            font-style: normal;
            display: block;
            position: absolute;
            top: -40px;
            left: 80px;
            width: 50%;
        }

        .span2 {
            font-style: normal;
            display: block;
            position: absolute;
            top: -25px;
            left: -70px;
            width: 50%;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 100%;height: 100%;background: white;">
        <div style="width: 100%;height: 40px;box-shadow: 0 1px 0 0 #cccccc;">
            <div id="DepartmentalAttendance" class="attendance_tag attendance_active" onclick="change_types(this.id)">
                部门考勤
            </div>
            <div id="LaborAttendance" class="attendance_tag" onclick="change_types(this.id)">
                劳务派遣考勤
            </div>
        </div>

        <div class="headline">
            <div id="search_but" onclick="select_dep_name()" style="float: right;vertical-align: top;width: 80px;margin-left: 10px;margin-top: 2px;margin-right: 10px;">
                <button style="width: 70px;margin-top: 2px;height:32px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;background: #00a0e9;color: white;border-radius: 3px;">搜索</button>
            </div>

            <div id="DepartmentalAttendanceSearch" style="float: right;vertical-align: top;width: 550px;">
                <div id="select_year" style="vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;margin-right: 10px;display: inline-block;">
                    <select name="year" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="year" class="dept_select">
                        {% for year_dict in year_list %}
                            <option value="{{ year_dict.value }}">{{ year_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>

                <div id="select_month" style="vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;margin-right: 10px;display: inline-block;">
                    <select name="month" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="month" class="dept_select">
                        <option value="">请选择月份</option>
                        {% for mon_dict in month_list %}
                            <option value="{{ mon_dict.value }}">{{ mon_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>

            <div id="DispatchAttendanceSearch" style="float: right;vertical-align: top;width: 550px;display: none;">
                <div id="search_year" style="vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;margin-right: 10px;display: inline-block;">
                    <select name="DispatchYear" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="DispatchYear" class="dept_select">
                        {% for year_dict in dispat_year_list %}
                            <option value="{{ year_dict.value }}">{{ year_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>

                <div id="search_month" style="vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;margin-right: 10px;display: inline-block;">
                    <select name="DispatchMonth" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="DispatchMonth" class="dept_select">
                        <option value="">请选择月份</option>
                        {% for mon_dict in dispat_month_list %}
                            <option value="{{ mon_dict.value }}">{{ mon_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>

            {% if xianshi_flag == "true" %}
                <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                        style="width: 150px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;margin-left: 1.5%;">
                    操作
                </button>
            {% endif %}

            <button id="sign_label" onclick="sgin_people()" style="width: 70px;height: 30px;line-height: 25px;border-radius: 3px;margin-top: 5px;background: #00a0e9;border: #00a0e9 solid 0.5px;color: white;letter-spacing: 3px;margin-left: 15px; display: {% if is_audit == 'true' %} inline-block {% else %} none {% endif %};">签字</button>
        </div>

        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()" style="z-index: 1000; position: absolute; width: 150px; height: auto;left: 15.3%; top: 120px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;text-align: center;">
            <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: left;margin-left: 20px;">
                上传考勤表
                <input type="file" name="party_main_body" id="party_main_body" onchange="upload_excel('check_work', 0)">
            </a>

            <button type="button" class="button_for_control">
                <a href="../../static/personnel/excel_model/考勤表格模板.xls">考勤表格模板下载</a>
            </button>
        </div>

        <div id="DepartmentQuery" style="width: 100%;height: 90%;overflow: auto;">
            {% if gauge_outfit %}
                <div style="width: 100%;height: 100%;">
                    <div style="width: 100%;">
                        <table style="width: 100%;margin-bottom: 10%;">
                            <tr style="width: 100%;">
                                <th colspan="23"
                                    style="height: 40px;width: 100%;border: #CCCCCC solid 0.5px;text-align: center;line-height: 40px;font-size: 18px;letter-spacing: 3px;border-top: none;">{{ gauge_outfit }}</th>
                            </tr>
                            <tr style="width: 100%;">
                                <td colspan="23"
                                    style="height: 35px;width: 100%;border: #CCCCCC solid 0.5px;line-height: 35px;">
                                    <p style="float: left;margin-left: 60px;">科 室：{{ department }}</p>
                                    <p style="float: right;margin-right: 60px;">上报时间：{{ create_time }}</p>
                                </td>
                            </tr>
                            <tr>
                                <td rowspan="2"
                                    style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">
                                    序号
                                </td>
                                <td rowspan="2"
                                    style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    科室
                                </td>
                                <td rowspan="2"
                                    style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                    工号
                                </td>
                                <td rowspan="2"
                                    style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">
                                    执业
                                </td>
                                <td rowspan="2"
                                    style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                    姓名
                                </td>
                                <td rowspan="2"
                                    style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 20px;text-align: center;">
                                    实际<br>出勤<br>天数
                                </td>
                                <td colspan="16"
                                    style="border: #CCCCCC solid 0.5px;width: 56%;height: 35px;line-height: 35px;text-align: center;letter-spacing: 2cm;">
                                    考勤动态
                                </td>
                                <td rowspan="2"
                                    style="border: #CCCCCC solid 0.5px;width: 15%;height: 35px;line-height: 35px;text-align: center;">
                                    备注
                                </td>
                            </tr>
                            <tr>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    上班
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    援荆
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    隔离
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    外差
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    进修
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    计生假
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    产假
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    年休假
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    事假
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    病假
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    工伤
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    探亲
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    婚假
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    丧假
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    放射假
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                    育儿假
                                </td>
                            </tr>
                            {% for foo in obj %}
                                <tr style="width: 100%;">
                                    <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">{{ foo.serial }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">{{ foo.department }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.job_number }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">{{ foo.practice }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.name }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 20px;text-align: center;">{{ foo.attendance_days }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.work_days }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.aid_jing }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.quarantine }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.heterodyne }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.education }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.planning }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.maternity }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.annual }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.absence }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.sick }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.industrial }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.visit }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.marriage }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.bereavement }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.vacation }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ foo.parental_leave }}</td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 15%;height: 35px;line-height: 35px;text-align: center;">{{ foo.notes }}</td>
                                </tr>
                            {% endfor %}
                            <tr>
                                <td colspan="23"
                                    style="border: #CCCCCC solid 0.5px;width: 100%;height: 50px;line-height: 50px;">
                                    <p style="float: left;margin-left: 10%;">
                                        负责人签字：
                                        {% if audit_dic.one.state == 'audit' %}
                                            <img src="{{ audit_dic.one.signature_picture }}" alt="" style="width: 100px;height: 35px;">
                                        {% endif %}
                                    </p>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="23"
                                    style="border: #CCCCCC solid 0.5px;width: 100%;height: 30px;line-height: 30px;padding-left: 1%;">
                                    注：1、请按科室人员实际上班情况填报，工号一定要准确。
                                </td>
                            </tr>
                            <tr>
                                <td colspan="23"
                                    style="border: #CCCCCC solid 0.5px;width: 100%;height: 30px;line-height: 30px;padding-left: 1%;">
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、上报时人员名单顺序尽量与上月保持一致，增加的人员分别排在最后（医、护分开）。
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            {% else %}
                <div style="width: 100%;height: 95%;display: flex;align-items:center;justify-content:center;">
                    <div style="width: 150px;height: 70px;left:50%;top:50%;text-align: center;">
                        <img src="../../static/public_file/images/暂无数据.png" alt="" style="width: 50px;height: 50px;">
                        <p style="color: #cfcfcf;">暂无数据</p>
                    </div>
                </div>
            {% endif %}
        </div>

        <div id="LaborDispatch" style="width: 100%;height: 90%;overflow: auto;display: none;vertical-align: top;">
            {% if DispatchTitle %}
                <div style="width: 100%;height: 100%;">
                    <div style="width: 100%;">
                        <table style="width: 100%;margin-bottom: 10%;">
                            <tr style="width: 100%;">
                                <th colspan="11" style="height: 40px;width: 100%;border: #CCCCCC solid 0.5px;text-align: center;line-height: 40px;font-size: 18px;letter-spacing: 3px;border-top: none;">{{ DispatchTitle }}</th>
                            </tr>
                            <tr style="width: 100%;">
                                <td colspan="11" style="height: 35px;width: 100%;border: #CCCCCC solid 0.5px;line-height: 35px;">
                                    <p style="float: left;margin-left: 60px;width: 400px;">科 室：{{ department }}</p>
                                    <p style="display: inline-block;vertical-align: top;">
                                        负责人签字：
                                        {% if Dispatch_audit_dic.one.state == 'audit' %}
                                            <img src="{{ Dispatch_audit_dic.one.signature_picture }}" alt="" style="width: 100px;height: 35px;">
                                        {% endif %}
                                    </p>
                                    <p style="float: right;margin-right: 60px;">上报时间：{{ DispatchCreate }}</p>
                                </td>
                            </tr>
                            <tr>
                                <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                    序号
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    科室
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 14%;height: 35px;line-height: 35px;text-align: center;">
                                    <div class="oline"> <span class="span1">考核项目</span> <span class="span2">姓 名</span> </div>
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    实际出勤天数
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    请假类别及天数
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    劳动纪律（20分）
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    工作质量（30分）
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    工作能力（30分）
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    其他（20分）
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    总得分
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                    备注
                                </td>
                            </tr>
                            {% for Dispatch in DispatchDataObj %}
                                <tr>
                                    <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.serial }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.department }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 14%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.project_name }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.attendance_days }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.leave_type }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.labor_discipline }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.work_quality }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.working_ability }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.other }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.total_score }}
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        {{ Dispatch.notes }}
                                    </td>
                                </tr>
                            {% endfor %}
                        </table>
                    </div>
                </div>
            {% else %}
                <div style="width: 100%;height: 95%;display: flex;align-items:center;justify-content:center;">
                    <div style="width: 150px;height: 70px;left:50%;top:50%;text-align: center;">
                        <img src="../../static/public_file/images/暂无数据.png" alt="" style="width: 50px;height: 50px;">
                        <p style="color: #cfcfcf;">暂无数据</p>
                    </div>
                </div>
            {% endif %}
        </div>
    </div>
{% endblock %}

{% block script %}
    <script src="../../static/personnel/js/jquery-1.11.1.min.js"></script>
    <script src="../../static/personnel/division_js/jquery.searchableSelect.js"></script>
    <script type="text/javascript">
        window.onload = function () {
            document.getElementById("statistics").className = "add_class";
            document.getElementById("attendance").className = "add-nav-active";
        };

        function upload_excel(types) {
            var date = new Date() // 获取时间
            var year = date.getFullYear() // 获取年
            var month = date.getMonth()
            var strDate = date.getDate() // 获取日

            if (strDate > 10 && strDate < 25) {
                alert("对不起，上传考勤记录的时间为25-10号！");
                document.getElementById("party_main_body").value = "";
                return false
             }

            if (date.getMonth()+1 === 1 && strDate <=10){
                year = year - 1;
            }

            if (strDate > 10) {
                month += 1
            }else if (strDate >= 25 && strDate <= 31) {
                month += 1
            }else {
                if (month === 0) {
                    month = 12
                }else {
                    month = month
                }
            }

            var UploadYearMonth = confirm("是否上传"+String(year)+"年"+String(month)+"月的考勤？")

            if (UploadYearMonth) {
                document.getElementById("loading").style.display = "inline-block";
                var form = new FormData();

                var files = document.getElementById("party_main_body").files[0];

                form.append('types', types);
                form.append('file', files);
                form.append('year', year);
                form.append('month', month);
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/system-setup/UploadExcel", true);
                xhr.send(form);
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            console.log(JsonDate);
                            if (JsonDate['code'] === 200) {
                                if (JsonDate["data"]) {
                                    alert("上传成功，审核人为：" + JsonDate["data"]+"，只需一人审核即可！")
                                }else {
                                    alert("上传成功！")
                                }
                                location.reload()
                            }else {
                                alert(JsonDate["message"])
                            }
                            document.getElementById("party_main_body").value = "";
                        }
                    }
                 };
            }
        }

        function sgin_people() {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var types = document.getElementsByClassName("attendance_tag attendance_active");
            if (types[0].id === 'DepartmentalAttendance') {
                form.append('types', '1');
                form.append('id', {{ CheckObj.id }});
            }else {
                form.append('types', '2');
                form.append('id', {{ DisObj.id }})
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/SignaturePersonnel", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("签名成功！")
                        if (JsonDate['code'] === 200) {
                            location.reload()
                        }
                    }
                }
            };
        }

        $(function(){
            $('select').searchableSelect();
        });

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function change_types(ele_id) {
            var is_audit_disp = '{{ is_audit_disp }}';
            var is_audit = '{{ is_audit }}';
            if (ele_id === "DepartmentalAttendance") {
                document.getElementById(ele_id).className="attendance_tag attendance_active";
                document.getElementById("LaborAttendance").className="attendance_tag";
                document.getElementById("DepartmentQuery").style.display="inline-block";
                document.getElementById("LaborDispatch").style.display="none";
                document.getElementById("DepartmentalAttendanceSearch").style.display="inline-block";
                document.getElementById("DispatchAttendanceSearch").style.display="none";
                var html_str = `
                <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: left;margin-left: 20px;">
                    上传考勤表
                    <input type="file" name="party_main_body" id="party_main_body" onchange="upload_excel('check_work', 0)">
                </a>

                <button type="button" class="button_for_control">
                    <a href="../../static/personnel/excel_model/考勤表格模板.xls">考勤表格模板下载</a>
                </button>
                `
                document.getElementById("page_one").innerHTML = '';
                $("#page_one").append(html_str);
                if (is_audit === 'true') {
                    document.getElementById("sign_label").style.display="inline-block";
                }else {
                    document.getElementById("sign_label").style.display="none";
                }
            }else {
                document.getElementById(ele_id).className="attendance_tag attendance_active";
                document.getElementById("DepartmentalAttendance").className="attendance_tag";
                document.getElementById("LaborDispatch").style.display="inline-block";
                document.getElementById("DepartmentQuery").style.display="none";
                document.getElementById("DepartmentalAttendanceSearch").style.display="none";
                document.getElementById("DispatchAttendanceSearch").style.display="inline-block";
                html_str = `
                <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: left;font-size: 12px;margin-left: 5px;">
                    劳务派遣考勤上传
                    <input type="file" name="party_main_body" id="party_main_body" onchange="upload_excel('labor_dispatch', 0)">
                </a>

                <button type="button" class="button_for_control">
                    <a href="../../static/personnel/excel_model/劳务派遣人员考勤及月度考核模板.xls">劳务派遣模板下载</a>
                </button>
                `
                document.getElementById("page_one").innerHTML = '';
                $("#page_one").append(html_str);
                if (is_audit_disp === 'true') {
                    document.getElementById("sign_label").style.display="inline-block";
                }else {
                    document.getElementById("sign_label").style.display="none";
                }
            }
        }

    </script>
{% endblock %}



